<template>
	<div class="type">
		<div class="title">
			<!--
			<span class="f-16 font-bold">{{ indexText }}、{{ props.typeTopic.name || props.textByTopicType[props.typeTopic.type] }}</span>
			(每小题{{ props.typeTopic.everyoneScore }}分，共{{ props.typeTopic.questionsList.length * props.typeTopic.everyoneScore }}分)
			-->
		</div>
		<topic
		v-for="(question, index) in props.typeTopic.questionsList"
		:key="question.id"
		:topic="question"
		:i="index"
		class="uni-mt-2"
		@setCollect="onSetCollect"
		/>
	</div>
</template>

<script lang="ts" setup>
import { toZhDigit } from '../utils/utils';
import topic from './topicError.vue';
import { QuestionItem } from '../utils/type';
import { computed } from 'vue';

const emit = defineEmits(['setCollect']);

interface QuestionsTypeVos {
    id: number;
    type: number;
    everyoneScore: number;
    fullScore: number;
    difficulty: number;
    questionsList: QuestionItem[];
    name?: string;
}

const props = defineProps<{
    typeTopic: QuestionsTypeVos;
    i: number;
    textByTopicType: any;
}>();

const indexText = computed(() => toZhDigit(props.i + 1));

const onSetCollect = (isCollect: 0 | 1, topic: QuestionItem) => {
	emit("setCollect", isCollect, topic);
};
</script>

<style lang="scss" scoped>

</style>